:root {
    --module-accent: #ffcf21;
    --module-border: rgba(255, 207, 33, 0.42);
}

body.foundation-module {
    min-height: 100vh;
    background: radial-gradient(circle at 50% 18%, rgba(255, 207, 33, 0.08), transparent 34%), #111;
}

.module-page {
    width: min(1120px, calc(100% - 32px));
    margin: 38px auto 80px;
}

.module-hero {
    max-width: 850px;
    margin: 0 auto 34px;
    text-align: center;
}

.module-eyebrow,
.reference-label {
    color: var(--module-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.module-hero h1 {
    margin: 12px 0;
    color: var(--module-accent);
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.module-hero p {
    line-height: 1.65;
}

.module-overview,
.reference-card {
    border: 1px solid var(--module-border);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 207, 33, 0.07), rgba(255, 255, 255, 0.025));
}

.module-overview {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
    gap: 34px;
    align-items: center;
    padding: 36px;
}

.module-overview > img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.module-overview h2,
.reference-card h2 {
    color: var(--module-accent);
}

.module-list {
    padding-left: 20px;
    line-height: 1.8;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.module-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 12px;
    background: var(--module-accent);
    color: #111;
    font-weight: 800;
    text-decoration: none;
}

.module-actions a.secondary {
    border: 1px solid var(--module-border);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: 28px;
}

.reference-card {
    min-width: 0;
    padding: 24px;
}

.reference-image-frame {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 320px;
    margin: 18px 0;
    padding: 14px;
    overflow: hidden;
    border-radius: 16px;
    background: #f3f2ed;
}

.reference-image-frame img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 430px;
    object-fit: contain;
    object-position: center;
}

.reference-card.rtm .reference-image-frame img {
    width: auto;
    max-width: 100%;
}

.reference-note {
    color: #ddd;
    line-height: 1.55;
}

.licence-pathway,
.controls-pathway-card,
.source-assurance,
.qa-module-section,
.qa-status-note {
    margin-top: 24px;
    padding: 28px;
    border: 1px solid var(--module-border);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 207, 33, 0.07), rgba(255, 255, 255, 0.025));
}

.licence-pathway { display: grid; grid-template-columns: 1fr 1.35fr; gap: 28px; align-items: center; }
.licence-pathway h2, .controls-pathway-card h2, .source-assurance h2, .qa-module-section h2 { color: var(--module-accent); }
.licence-code-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.licence-code-options button {
    min-height: 84px; padding: 14px; border: 1px solid var(--module-border); border-radius: 14px;
    color: #fff; background: #1b1b1b; font: inherit; font-weight: 900; cursor: pointer;
}
.licence-code-options button small { display: block; margin-top: 7px; color: #c9c9c9; font-weight: 500; }
.licence-code-options button:hover, .licence-code-options button.selected { color: #111; background: var(--module-accent); box-shadow: 0 0 22px rgba(255, 207, 33, 0.2); }
.licence-code-options button.selected small { color: #222; }
.controls-pathway-card { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(0, 1.1fr); gap: 32px; align-items: center; }
.controls-pathway-images { display: grid; gap: 12px; }
.controls-pathway-images img { width: 100%; max-height: 260px; object-fit: contain; border-radius: 16px; background: #fff; }
.module-progress-summary { display: flex; justify-content: space-between; gap: 20px; margin: 24px 0 8px; color: #ddd; }
.controls-code-label { color: #ffcf21; font-weight: 700; }
.control-image-area img { width: 100%; max-height: 390px; object-fit: contain; background: #fff; }
.qa-mode-banner { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 11px 18px; border-block: 1px solid #46d8ff; background: #082a36; color: #fff; font-style: normal; }
.qa-mode-banner strong { color: #46d8ff; letter-spacing: 1.5px; }
.qa-mode-banner a { color: #ffcf21; font-weight: 800; }
.qa-journey { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.qa-journey a, .qa-stage-links a { padding: 9px 13px; border: 1px solid var(--module-border); border-radius: 10px; color: #111; background: var(--module-accent); font-weight: 800; text-decoration: none; }
.qa-status-note { color: #e5e5e5; line-height: 1.6; }
.qa-prototype-link { display:inline-block; margin-left:8px; color:#46d8ff; font-weight:900; }
.qa-unbuilt-note { margin: 18px auto 0; padding: 12px 16px; border: 1px solid #46d8ff; border-radius: 12px; color: #dff8ff; background: rgba(8,42,54,.8); }
.qa-module-section summary { color: var(--module-accent); font-size: 1.3rem; font-weight: 900; cursor: pointer; }
.qa-lesson-row { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(0, 1.2fr); gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.qa-stage-links { display: flex; flex-wrap: wrap; gap: 7px; }
.qa-stage-links a { padding: 7px 10px; font-size: .78rem; }

@media (max-width: 760px) {
    .licence-pathway, .controls-pathway-card, .qa-lesson-row { grid-template-columns: 1fr; }
    .licence-code-options { grid-template-columns: 1fr; }
    .qa-mode-banner { position: static; flex-direction: column; gap: 4px; text-align: center; }
}

@media (max-width: 760px) {
    .module-page {
        width: min(100% - 22px, 1120px);
        margin-top: 26px;
    }

    .module-overview,
    .reference-grid {
        grid-template-columns: 1fr;
    }

    .module-overview {
        padding: 24px 18px;
    }

    .reference-image-frame {
        min-height: 230px;
    }
}
